#!/usr/bin/env bash

destDir='/mnt/nfs'
nfsSeverIP=192.168.120.161
dryRun=false

function usage() {
    echo "Usage:$( basename $0 ) -d <mount_dir>"
    echo -e "参数:"
    echo -e "    -d <mount_dir>\t\t:指定目标目录, 缺省${destDir}"
    echo -e "    -n \t\t\t\t:Dry run"
    exit
}

argCnt=0
while getopts "d:n" arg
do
    case $arg in
        d)
            destDir="$OPTARG"
            argCnt=$(( $argCnt + 2 ))
            ;;
        n)
            dryRun=true
            argCnt=$(( $argCnt + 1 ))
            ;;
        *)
            usage
            ;;
    esac
done

shift ${argCnt}

echo "mount -o nolock,addr=${nfsSeverIP} -t nfs ${nfsSeverIP}:/login_home/liujinsong/nfs ${destDir}"
if ${dryRun}
then
    exit
fi
sudo mount -o nolock,addr=${nfsSeverIP} -t nfs ${nfsSeverIP}:/login_home/liujinsong/nfs ${destDir}
